package com.shuzixiangcun.service.admin;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shuzixiangcun.entity.Orders;
import com.shuzixiangcun.entity.Products;
import com.shuzixiangcun.dao.ProductsDao;

import com.shuzixiangcun.entity.Users;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * (Products)表服务实现类
 *
 * @author makejava
 * @since 2024-06-28 11:00:56
 */
@Service
public class ProductsServiceImpl {
    @Resource
    private ProductsDao productsDao;


    public List<Products> queryList() {
        return productsDao.queryList();
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */

    public Products queryById(Integer id) {
        return this.productsDao.queryById(id);
    }

    public int update3(Products products) {
        return this.productsDao.update3(products);
    }



    /**
     * 新增数据
     *
     * @param products 实例对象
     * @return 实例对象
     */

    public int insert(Products products) {

        return this.productsDao.insert(products);
    }

    /**
     * 修改数据
     *
     * @param products 实例对象
     * @return 实例对象
     */

    public int update(Products products) {

        return this.productsDao.update(products);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */

    public int deleteById(Integer id) {
        return this.productsDao.deleteById(id) ;
    }
    public List<Products> showList(String search) {
        return this.productsDao.showList(search);
    }

    public PageInfo<Products> getPageInfo(Integer pageNo, Integer pageSize, String search) {
        PageHelper.startPage(pageNo, pageSize,true);
        List<Products> mangerList=productsDao.showList(search);
        return new PageInfo<Products>(mangerList);
    }
}
